var map;
var point1;
var vectorLayer;
var polygonFeatures = [];

var vectorLayerOne;
var polygonFeaturesOne = [];

var vectorLayerAdmin;

var myFeatures;

function init() {
	//		var map = new OpenLayers.Map("map");
	var vLayer = new OpenLayers.Layer.Vector("EditToolBar");
	var areaLayer = new OpenLayers.Layer.Vector("areaLayer");

	var bounds = new OpenLayers.Bounds(//地图区域范围  
			-55.546875, 67.148438, 169.804688, -21.796875);
	var options = {
		controls : [],
		maxExtent : bounds,
		maxResolution : 0.23808203125,
		projection : "EPSG:4326",
		numZoomLevels : 7,
		units : 'degrees'
	};
	//加多边形
	vLayer.events.register('beforefeatureadded', vLayer, function(e) {
		//to juduge the vLayer have a featur or not,if exist a feature,remove it		
			vLayer.destroyFeatures();
		});
	vLayer.events.register('featureadded', vLayer, function(e) {
		//OpenLayers.Geometry.Polygon
			var rect = e.feature.geometry;
			var bounds = rect.getBounds();
			//alert(rect);
			var longLatStr = bounds.toBBOX();
			getlonglat(longLatStr);//将框选的经纬度填入查询框

		});

	//	var feature = new OpenLayers.Feature.Vector(e.feature.geometry);
	//	
	//	areaLayer.addFeatures([feature]);

	//	var navCtl = new OpenLayers.Control.Navigation();
	//	var panel = new OpenLayers.Control.Panel( {
	//		defaultControl : navCtl
	//	});
	//	panel.addControls( [ navCtl ]);

	map = new OpenLayers.Map("map", {
		controls : [ new OpenLayers.Control.PanZoom(),
				new OpenLayers.Control.EditingToolbar(vLayer) ]
	//加矩形框改过源码  map/theme/default/img/editing_tool_bar.png

			}, options);
	
//	if(map=='undefined'){
//		init();
//		return false;
//	}

	//	var africa_wms = new OpenLayers.Layer.WMS("world", GEOSERVER_IP
	//			+ "/geoserver/" + GEOSERVER_WORKSPACES + "/wms", {
	//		layers : GEOSERVER_WORKSPACES + ":" + LayerName
	//	});

	var africa_wms = new OpenLayers.Layer.WMS("basic", GEOSERVER_IP
			+ "/geoserver/wms", {
		layers : "APSCO"
	});

	//添加矩形画框功能 start-->
	polyOptions = {
		sides : 4
	};
	var polygonControl = new OpenLayers.Control.DrawFeature(vLayer,
			OpenLayers.Handler.RegularPolygon, {
				handlerOptions : polyOptions
			});
	map.addControl(polygonControl);
	//<-- end 添加矩形画框功能

	map.addLayers( [ africa_wms, vLayer ]);
	map.addControl(new OpenLayers.Control.LayerSwitcher());//layers 列表
	map.zoomToMaxExtent();
	map.setCenter(new OpenLayers.LonLat(88, 44), 3);

	map.addControl(new OpenLayers.Control.MousePosition());

	//map.addControl(new OpenLayers.Control.LayerSwitcher( {
	//	'ascending' : false
	//}));
	//	map.addControl(new OpenLayers.Control.OverviewMap()); //添加鹰眼图  
	//	boxExtend(map);

	//初始化画框图层
	//	var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
	//	renderer = (renderer) ? [ renderer ]
	//			: OpenLayers.Layer.Vector.prototype.renderers;

	//	var layer_style = OpenLayers.Util.extend( {},
	//			OpenLayers.Feature.Vector.style['default']);
	//	layer_style.fillOpacity = 0.2;
	//	layer_style.graphicOpacity = 1;

	//	vectorLayer = new OpenLayers.Layer.Vector("", {
	//		style : layer_style,
	//		renderers : renderer
	//	});
	//
	//	vectorLayerOne = new OpenLayers.Layer.Vector("", {
	//		style : layer_style,
	//		renderers : renderer
	//	});

	//此图层用于数据显示
	var myStyles = new OpenLayers.StyleMap( {
		"default" : new OpenLayers.Style( {
			pointRadius : "${type}", // sized according to type attribute

			graphicZIndex : 1,

			fillColor : "white",
			fillOpacity : 0.01,//透明度
			hoverFillColor : "white",
			hoverFillOpacity : 0.8,
			strokeColor : "#00008B",
			strokeOpacity : 1,
			strokeWidth : 1,//边框线的宽度
			strokeLinecap : "round",
			strokeDashstyle : "solid",
			hoverStrokeColor : "red",
			hoverStrokeOpacity : 1,
			hoverStrokeWidth : 0.2,
			pointRadius : 6,
			hoverPointRadius : 1,
			hoverPointUnit : "%",
			pointerEvents : "visiblePainted",
			cursor : "inherit"
		})
	});

	// Create a vector layer and give it your style map.
	vectorLayer = new OpenLayers.Layer.Vector("vectorData", {
		styleMap : myStyles
	});

	//此图层用于高亮显示图层
	var myStylesOne = new OpenLayers.StyleMap( {
		"default" : new OpenLayers.Style( {
			pointRadius : "${type}", // sized according to type attribute

			graphicZIndex : 1,

			fillColor : "red",
			fillOpacity : 0.7,//透明度
			hoverFillColor : "red",
			hoverFillOpacity : 0.8,
			strokeColor : "",
			strokeOpacity : 1,
			strokeWidth : 1,//边框线的宽度
			strokeLinecap : "round",
			strokeDashstyle : "solid",
			hoverStrokeColor : "red",
			hoverStrokeOpacity : 1,
			hoverStrokeWidth : 0.2,
			pointRadius : 6,
			hoverPointRadius : 1,
			hoverPointUnit : "%",
			pointerEvents : "visiblePainted",
			cursor : "inherit"
		})
	});

	// Create a vector layer and give it your style map.
	vectorLayerOne = new OpenLayers.Layer.Vector("vectorDataOne", {
		styleMap : myStylesOne
	});

	//此图层用于行政区高亮
	var myStylesAdmin = new OpenLayers.StyleMap( {
		"default" : new OpenLayers.Style( {
			pointRadius : "${type}", // sized according to type attribute

			graphicZIndex : 1,

			fillColor : "blue",
			fillOpacity : 0.2,//透明度
			hoverFillColor : "blue",
			hoverFillOpacity : 0.8,
			strokeColor : "",
			strokeOpacity : 1,
			strokeWidth : 1,//边框线的宽度
			strokeLinecap : "round",
			strokeDashstyle : "solid",
			hoverStrokeColor : "red",
			hoverStrokeOpacity : 1,
			hoverStrokeWidth : 0.2,
			pointRadius : 6,
			hoverPointRadius : 1,
			hoverPointUnit : "%",
			pointerEvents : "visiblePainted",
			cursor : "inherit"
		})
	});

	// Create a vector layer and give it your style map.
	vectorLayerAdmin = new OpenLayers.Layer.Vector("vectorDataAdmin", {
		styleMap : myStylesAdmin
	});

}

//将框选的经纬度填入查询框
function getlonglat(str) {
	var longlat = str.split(",");
	ltlong = longlat[0].toString().split(".");
	ltlat = longlat[1].toString().split(".");
	rblong = longlat[2].toString().split(".");
	rblat = longlat[3].toString().split(".");

	jQuery("#leftTlong").val(ltlong[0] + "." + ltlong[1].substr(0, 3));
	jQuery("#leftTlat").val(ltlat[0] + "." + ltlat[1].substr(0, 3));
	jQuery("#rightBlong").val(rblong[0] + "." + rblong[1].substr(0, 3));
	jQuery("#rightBlat").val(rblat[0] + "." + rblat[1].substr(0, 3));

}

//function init(){
//	var vLayer = new OpenLayers.Layer.Vector("vector");
//	vLayer.events.register('beforefeatureadded', vLayer, function(e){
//		
//		//to juduge the vLayer have a featur or not,if exist a feature,remove it		
//		vLayer.destroyFeatures();					
//	});
//	
//	vLayer.events.register('featureadded', vLayer, function(e){		
//		//OpenLayers.Geometry.Polygon
//		var rect = e.feature.geometry;
//		var bounds = rect.getBounds();
//		var longLatStr = bounds.toBBOX(); 
//		alert(longLatStr);
//	});
//	
//    var navCtl = new OpenLayers.Control.Navigation();
//    var panel = new OpenLayers.Control.Panel({defaultControl: navCtl});
//    panel.addControls([navCtl]);
//    
//    var polygonLayer = new OpenLayers.Layer.Vector("Polygon Layer");
//
//    polyOptions = {sides: 4};
//    var polygonControl = new OpenLayers.Control.DrawFeature(polygonLayer,
//                                    OpenLayers.Handler.RegularPolygon,
//                                    {handlerOptions: polyOptions});
//
//    map = new OpenLayers.Map("map", {
//        controls: [
//            new OpenLayers.Control.PanZoom(),
//            new OpenLayers.Control.MousePosition(),
//            new OpenLayers.Control.EditingToolbar(vLayer)
//        ]
//    });
//
//	var world_wms = new OpenLayers.Layer.WMS(
//	    "world",
//	    GEOSERVER_IP+ "/geoserver/" + GEOSERVER_WORKSPACES + "/wms",
//	    {layers: GEOSERVER_WORKSPACES + ":" + LayerName}
//	);
//	map.addLayers([world_wms, vLayer]);
//	map.addControl(new OpenLayers.Control.LayerSwitcher());
//	map.addControl(polygonControl);
//	//map.addControl(navCtl, new OpenLayers.Pixel(50, 50));
////	map.zoomToMaxExtent();	
////	map.setCenter(new OpenLayers.LonLat(107,35),3);
//}

//将数据添加到地图的方法(将地图面信息放到全局变量里)
function DataToList(rblat, ltlong, ltlat, rblong, str, rtlong, rtlat, lblong,
		lblat) {

	//alert(str);

	point1 = new OpenLayers.Geometry.Point(ltlong, ltlat);
	var point2 = new OpenLayers.Geometry.Point(rtlong, rtlat);
	var point3 = new OpenLayers.Geometry.Point(rblong, rblat);
	var point4 = new OpenLayers.Geometry.Point(lblong, lblat);
	//	var point5 = new OpenLayers.Geometry.Point(ltlong, ltlat);

	var newPoint1 = new OpenLayers.Geometry.Point(point1.x, point1.y);
	var newPoint2 = new OpenLayers.Geometry.Point(point2.x, point2.y);
	var newPoint3 = new OpenLayers.Geometry.Point(point3.x, point3.y);
	var newPoint4 = new OpenLayers.Geometry.Point(point4.x, point4.y);
	//	var newPoint5 = new OpenLayers.Geometry.Point(point5.x, point5.y);
	var pointList = [];
	pointList.push(newPoint1);
	pointList.push(newPoint2);
	pointList.push(newPoint3);
	pointList.push(newPoint4);
	pointList.push(newPoint1);

	var linearRing = new OpenLayers.Geometry.LinearRing(pointList);

	var polygonFeature = new OpenLayers.Feature.Vector(
			new OpenLayers.Geometry.Polygon( [ linearRing ]));

	polygonFeature.fid = str;

	polygonFeatures.push(polygonFeature);

}
//将数据往地图上贴图(全局变量里的数据)
function addDataToMap() {

	map.addLayer(vectorLayer);
	map.setCenter(new OpenLayers.LonLat(point1.x, point1.y), map.getZoom());

	vectorLayer.addFeatures(polygonFeatures);
	polygonFeatures = [];//初始化图层列表
}

//将数据添加到地图的方法(一条数据,用于高亮)
function oneDataToList(rblat, ltlong, ltlat, rblong, str, rtlong, rtlat,
		lblong, lblat) {

	polygonFeaturesOne = [];
	//alert(str);

	var point1 = new OpenLayers.Geometry.Point(ltlong, ltlat);
	var point2 = new OpenLayers.Geometry.Point(rtlong, rtlat);
	var point3 = new OpenLayers.Geometry.Point(rblong, rblat);
	var point4 = new OpenLayers.Geometry.Point(lblong, lblat);

	var newPoint1 = new OpenLayers.Geometry.Point(point1.x, point1.y);
	var newPoint2 = new OpenLayers.Geometry.Point(point2.x, point2.y);
	var newPoint3 = new OpenLayers.Geometry.Point(point3.x, point3.y);
	var newPoint4 = new OpenLayers.Geometry.Point(point4.x, point4.y);
	var pointList = [];
	pointList.push(newPoint1);
	pointList.push(newPoint2);
	pointList.push(newPoint3);
	pointList.push(newPoint4);
	pointList.push(newPoint1);

	var linearRing = new OpenLayers.Geometry.LinearRing(pointList);

	var PolygonList = [];
	PolygonList = new OpenLayers.Geometry.Polygon( [ linearRing ]);
	var polygonFeature = new OpenLayers.Feature.Vector(PolygonList);

	polygonFeaturesOne.push(polygonFeature);

	map.addLayer(vectorLayerOne);

	vectorLayerOne.addFeatures(polygonFeaturesOne);

}

//获取行政区的polygon
function getPolygonList(strgid, adminstr) {
	var polygon = [];
	jQuery.post("adminpolygon.html", {
		gid : strgid,
		admin : adminstr
	}, function(data) {
		try {
			vectorLayerAdmin.removeAllFeatures();
			map.addLayer(vectorLayerAdmin);
			var polygonFeaturesAdmin = [];
			if ("POLY" == data.state) {//单个多边形的行政区

				var pointList = [];
				//alert(data.adminpolygon);

			var polyList = [];
			polyList = data.adminpolygon.split(",");
			var adminlong;
			var adminlat;
			for ( var i = 0; i < polyList.length; i++) {
				adminlong = polyList[i].split("_")[0];
				adminlat = polyList[i].split("_")[1];

				var point = new OpenLayers.Geometry.Point(adminlong - 0,
						adminlat - 0);
				var newPoint = new OpenLayers.Geometry.Point(point.x, point.y);
				pointList.push(newPoint);
			}

			var level = 3;
			if ("province" == adminstr) {
				level = 6;
			}
			if ("county" == adminstr) {
				level = 8;
			}

			map.setCenter(new OpenLayers.LonLat(adminlong, adminlat), level);

			var linearRing = new OpenLayers.Geometry.LinearRing(pointList);
			var PolygonList = [];
			PolygonList = new OpenLayers.Geometry.Polygon( [ linearRing ]);
			var polygonFeature = new OpenLayers.Feature.Vector(PolygonList);

			polygonFeaturesAdmin.push(polygonFeature);

			vectorLayerAdmin.addFeatures(polygonFeaturesAdmin);

		} else if ("MULT" == data.state) {//多个多边形的行政区的遍历

				var multPolygon = [];
				var adminlong;
				var adminlat;
				multPolygon = data.adminpolygon.split("&");
				var level = 3;
				for ( var i = 0; i < multPolygon.length; i++) {
					
					var bignational = strgid + adminstr;
					if (bignational == '12national') {
						if (i == 5)
							break;
					}
					
					var polyList = [];
					polyList = multPolygon[i].split(",");
					var pointList = [];
					for ( var j = 0; j < polyList.length; j++) {

						adminlong = polyList[j].split("_")[0];
						adminlat = polyList[j].split("_")[1];

						var point = new OpenLayers.Geometry.Point(
								adminlong - 0, adminlat - 0);
						var newPoint = new OpenLayers.Geometry.Point(point.x,
								point.y);

						pointList.push(newPoint);
					}
					var linearRing = new OpenLayers.Geometry.LinearRing(
							pointList);
					var PolygonList = [];
					PolygonList = new OpenLayers.Geometry.Polygon(
							[ linearRing ]);

					var polygonFeature = new OpenLayers.Feature.Vector(
							PolygonList);

					polygonFeaturesAdmin.push(polygonFeature);

					if ("province" == adminstr) {
						level = 6;
					}
					if ("county" == adminstr) {
						level = 8;
					}

					vectorLayerAdmin.addFeatures(polygonFeaturesAdmin);
				}
				map
						.setCenter(new OpenLayers.LonLat(adminlong, adminlat),
								level);

			}

		} catch (e) {
			alert("Error in XML response:" + e);
		}
	}, 'JSON');

}

//将数据往地图上贴图(全局变量里的数据)
function addImageToMap(leftlowlong, leftlowlat, rightlowlong, rightlowlat,
		righttoplong, righttoplat, lefttoplong, lefttoplat, thumbfile) {
	var options = {
		numZoomLevels : map.getZoom() + 10,
		isBaseLayer : false
	};
	var ImageLayer = new OpenLayers.Layer.Image('City Lights',
			'/APSCO/ext/images/page_bg.jpg', new OpenLayers.Bounds(leftlowlong,
					leftlowlat, righttoplong, righttoplat),
			new OpenLayers.Size(5, 3), options);
	map.addLayer(ImageLayer);
}
//从列表上将图片贴到地图上
function atListAddTomap(str) {
	var longlatsatellite = jQuery("#hidden" + str).val().split(",");
	var longandlat = longlatsatellite[0].split("_");
	//alert(longlatsatellite[2])

	var options = {
		numZoomLevels : map.getZoom() + 10,
		isBaseLayer : false
	};
	var ImageLayer = new OpenLayers.Layer.Image('City Lights',
			longlatsatellite[2], new OpenLayers.Bounds(longandlat[6],
					longandlat[7], longandlat[4], longandlat[5]),
			new OpenLayers.Size(5, 3), options);
	map.addLayer(ImageLayer);

}

//删除图层上的所有数据
function removeAllFea() {
	vectorLayer.removeAllFeatures();

}
//每条数据画高亮,鼠标移进事件
function heigthLight(str) {
	jQuery("#" + str).parent().parent().attr("class", 'red');

	var longlatsatellite = jQuery("#hidden" + str).val().split(",");//38.0174_113.726_38.6475_114.232_114.401_38.5456_113.562_38.1186,ZY02C_PAN_14747

	var longandlat = longlatsatellite[0].split("_");
	var satellite = longlatsatellite[1];

	vectorLayerOne.removeAllFeatures();
	oneDataToList(longandlat[0], longandlat[1], longandlat[2], longandlat[3],
			satellite, longandlat[4], longandlat[5], longandlat[6],
			longandlat[7]);

}
//取消高亮，鼠标移出事件
function heigthLightCrush(str) {
	jQuery("#" + str).parent().parent().attr("class", '');
	vectorLayerOne.removeAllFeatures();
}

//点击数据在右边显示详细信息
function getDataDetails(str) {
	//alert(str);

	getdataformbase(str);
}

//显示一条数据的详细信息
function getdataformbase(str) {
	jQuery
			.post(
					"getdatadetails.html",
					{
						uniqueness : str,
						prosele : longandlat[4]
					},
					function(data) {

						try {
							var jqueryObj = jQuery(data);
							var productid = jqueryObj.find("productid").text();
							var sceneid = jqueryObj.find("sceneid").text();
							var productdate = jqueryObj.find("productdate")
									.text();
							var mapprojection = jqueryObj.find("mapprojection")
									.text();
							var producttype = jqueryObj.find("producttype")
									.text();
							var earthmodel = jqueryObj.find("earthmodel")
									.text();
							var sensorid = jqueryObj.find("sensorid").text();
							var satelliteid = jqueryObj.find("satelliteid")
									.text();
							var receivestationid = jqueryObj.find(
									"receivestationid").text();
							var receivetime = jqueryObj.find("receivetime")
									.text();
							var orbittype = jqueryObj.find("orbittype").text();
							var atttype = jqueryObj.find("atttype").text();
							var stripid = jqueryObj.find("stripid").text();
							var producetype = jqueryObj.find("producetype")
									.text();
							var productlevel = jqueryObj.find("productlevel")
									.text();
							var productformat = jqueryObj.find("productformat")
									.text();
							var scenedate = jqueryObj.find("scenedate").text();
							var bandnumber = jqueryObj.find("bandnumber")
									.text();
							var scenepath = jqueryObj.find("scenepath").text();
							var scenerow = jqueryObj.find("scenerow").text();
							var satpath = jqueryObj.find("satpath").text();
							var satrow = jqueryObj.find("satrow").text();
							var scenecount = jqueryObj.find("scenecount")
									.text();
							var sceneshift = jqueryObj.find("sceneshift")
									.text();
							var starttime = jqueryObj.find("starttime").text();
							var endtime = jqueryObj.find("endtime").text();
							var centertime = jqueryObj.find("centertime")
									.text();

							var startline = jqueryObj.find("startline").text();
							var endline = jqueryObj.find("endline").text();
							var imagegsd = jqueryObj.find("imagegsd").text();
							var widthinpixels = jqueryObj.find("widthinpixels")
									.text();
							var heightinpixels = jqueryObj.find(
									"heightinpixels").text();
							var widthinmeters = jqueryObj.find("widthinmeters")
									.text();
							var heightinmeters = jqueryObj.find(
									"heightinmeters").text();
							var regionname = jqueryObj.find("regionname")
									.text();
							var cloudpercent = jqueryObj.find("cloudpercent")
									.text();
							var datasize = jqueryObj.find("datasize").text();
							var rollviewingangle = jqueryObj.find(
									"rollviewingangle").text();
							var pitchviewingangle = jqueryObj.find(
									"pitchviewingangle").text();
							var rollsatelliteangle = jqueryObj.find(
									"rollsatelliteangle").text();
							var pitchsatelliteangle = jqueryObj.find(
									"pitchsatelliteangle").text();
							var yawsatelliteangle = jqueryObj.find(
									"yawsatelliteangle").text();
							var solarazimuth = jqueryObj.find("solarazimuth")
									.text();
							var solarzenith = jqueryObj.find("solarzenith")
									.text();
							var satelliteazimuth = jqueryObj.find(
									"satelliteazimuth").text();
							var satellitezenith = jqueryObj.find(
									"satellitezenith").text();
							var gainmode = jqueryObj.find("gainmode").text();
							var integrationtime = jqueryObj.find(
									"integrationtime").text();
							var integrationlevel = jqueryObj.find(
									"integrationlevel").text();
							var earthellipsoid = jqueryObj.find(
									"earthellipsoid").text();
							var zoneno = jqueryObj.find("zoneno").text();
							var resamplingkernel = jqueryObj.find(
									"resamplingkernel").text();
							var heightmode = jqueryObj.find("heightmode")
									.text();
							var ephemerisdata = jqueryObj.find("ephemerisdata")
									.text();
							var attitudedata = jqueryObj.find("attitudedata")
									.text();
							var radiometricmethod = jqueryObj.find(
									"radiometricmethod").text();
							var mtfcorrection = jqueryObj.find("mtfcorrection")
									.text();
							var denoise = jqueryObj.find("denoise").text();
							var rayleighcorrection = jqueryObj.find(
									"rayleighcorrection").text();
							var usedgcpno = jqueryObj.find("usedgcpno").text();
							var centerlatitude = jqueryObj.find(
									"centerlatitude").text();
							var centerlongitude = jqueryObj.find(
									"centerlongitude").text();
							var topleftlatitude = jqueryObj.find(
									"topleftlatitude").text();
							var topleftlongitude = jqueryObj.find(
									"topleftlongitude").text();
							var toprightlatitude = jqueryObj.find(
									"toprightlatitude").text();
							var toprightlongitude = jqueryObj.find(
									"toprightlongitude").text();
							var bottomrightlatitude = jqueryObj.find(
									"bottomrightlatitude").text();
							var bottomrightlongitude = jqueryObj.find(
									"bottomrightlongitude").text();
							var bottomleftlatitude = jqueryObj.find(
									"bottomleftlatitude").text();
							var bottomleftlongitude = jqueryObj.find(
									"bottomleftlongitude").text();
							var topleftmapx = jqueryObj.find("topleftmapx")
									.text();
							var topleftmapy = jqueryObj.find("topleftmapy")
									.text();
							var toprightmapx = jqueryObj.find("toprightmapx")
									.text();
							var toprightmapy = jqueryObj.find("toprightmapy")
									.text();
							var bottomrightmapx = jqueryObj.find(
									"bottomrightmapx").text();
							var bottomrightmapy = jqueryObj.find(
									"bottomrightmapy").text();
							var bottomleftmapx = jqueryObj.find(
									"bottomleftmapx").text();
							var bottomleftmapy = jqueryObj.find(
									"bottomleftmapy").text();
							var orbitid = jqueryObj.find("orbitid").text();
							var overalldataquality = jqueryObj.find(
									"overalldataquality").text();
							var thumbfilelocation = jqueryObj.find(
									"thumbfilelocation").text();

							jQuery("#productidvalue").replaceWith(
									"<td id ='productidvalue'>" + productid
											+ "</td>");
							jQuery("#sceneidvalue").replaceWith(
									"<td id ='sceneidvalue'>" + sceneid
											+ "</td>");
							jQuery("#productdatevalue").replaceWith(
									"<td id ='productdatevalue'>" + productdate
											+ "</td>");
							jQuery("#mapprojectionvalue").replaceWith(
									"<td id ='mapprojectionvalue'>"
											+ mapprojection + "</td>");
							jQuery("#producttypevalue").replaceWith(
									"<td id ='producttypevalue'>" + producttype
											+ "</td>");
							jQuery("#earthmodelvalue").replaceWith(
									"<td id ='earthmodelvalue'>" + earthmodel
											+ "</td>");
							jQuery("#sensoridvalue").replaceWith(
									"<td id ='sensoridvalue'>" + sensorid
											+ "</td>");
							jQuery("#satelliteidvalue").replaceWith(
									"<td id ='satelliteidvalue'>" + satelliteid
											+ "</td>");
							jQuery("#receivestationidvalue").replaceWith(
									"<td id ='receivestationidvalue'>"
											+ receivestationid + "</td>");
							jQuery("#receivetimevalue").replaceWith(
									"<td id ='receivetimevalue'>" + receivetime
											+ "</td>");
							jQuery("#orbittypevalue").replaceWith(
									"<td id ='orbittypevalue'>" + orbittype
											+ "</td>");
							jQuery("#atttypevalue").replaceWith(
									"<td id ='atttypevalue'>" + atttype
											+ "</td>");
							jQuery("#stripidvalue").replaceWith(
									"<td id ='stripidvalue'>" + stripid
											+ "</td>");
							jQuery("#producetypevalue").replaceWith(
									"<td id ='producetypevalue'>" + producetype
											+ "</td>");
							jQuery("#productlevelvalue").replaceWith(
									"<td id ='productlevelvalue'>"
											+ productlevel + "</td>");
							jQuery("#productformatvalue").replaceWith(
									"<td id ='productformatvalue'>"
											+ productformat + "</td>");
							jQuery("#scenedatevalue").replaceWith(
									"<td id ='scenedatevalue'>" + scenedate
											+ "</td>");
							jQuery("#bandnumbervalue").replaceWith(
									"<td id ='bandnumbervalue'>" + bandnumber
											+ "</td>");
							jQuery("#scenepathvalue").replaceWith(
									"<td id ='scenepathvalue'>" + scenepath
											+ "</td>");
							jQuery("#scenerowvalue").replaceWith(
									"<td id ='scenerowvalue'>" + scenerow
											+ "</td>");
							jQuery("#satpathvalue").replaceWith(
									"<td id ='satpathvalue'>" + satpath
											+ "</td>");
							jQuery("#satrowvalue")
									.replaceWith(
											"<td id ='satrowvalue'>" + satrow
													+ "</td>");
							jQuery("#scenecountvalue").replaceWith(
									"<td id ='scenecountvalue'>" + scenecount
											+ "</td>");
							jQuery("#sceneshiftvalue").replaceWith(
									"<td id ='sceneshiftvalue'>" + sceneshift
											+ "</td>");
							jQuery("#starttimevalue").replaceWith(
									"<td id ='starttimevalue'>" + starttime
											+ "</td>");
							jQuery("#endtimevalue").replaceWith(
									"<td id ='endtimevalue'>" + endtime
											+ "</td>");
							jQuery("#centertimevalue").replaceWith(
									"<td id ='centertimevalue'>" + centertime
											+ "</td>");
							jQuery("#startlinevalue").replaceWith(
									"<td id ='startlinevalue'>" + startline
											+ "</td>");
							jQuery("#endlinevalue").replaceWith(
									"<td id ='endlinevalue'>" + endline
											+ "</td>");
							jQuery("#imagegsdvalue").replaceWith(
									"<td id ='imagegsdvalue'>" + imagegsd
											+ "</td>");
							jQuery("#widthinpixelsvalue").replaceWith(
									"<td id ='widthinpixelsvalue'>"
											+ widthinpixels + "</td>");
							jQuery("#heightinpixelsvalue").replaceWith(
									"<td id ='heightinpixelsvalue'>"
											+ heightinpixels + "</td>");
							jQuery("#widthinmetersvalue").replaceWith(
									"<td id ='widthinmetersvalue'>"
											+ widthinmeters + "</td>");
							jQuery("#heightinmetersvalue").replaceWith(
									"<td id ='heightinmetersvalue'>"
											+ heightinmeters + "</td>");
							jQuery("#regionnamevalue").replaceWith(
									"<td id ='regionnamevalue'>" + regionname
											+ "</td>");
							jQuery("#cloudpercentvalue").replaceWith(
									"<td id ='cloudpercentvalue'>"
											+ cloudpercent + "</td>");
							jQuery("#datasizevalue").replaceWith(
									"<td id ='datasizevalue'>" + datasize
											+ "</td>");
							jQuery("#rollviewinganglevalue").replaceWith(
									"<td id ='rollviewinganglevalue'>"
											+ rollviewingangle + "</td>");
							jQuery("#pitchviewinganglevalue").replaceWith(
									"<td id ='pitchviewinganglevalue'>"
											+ pitchviewingangle + "</td>");
							jQuery("#rollsatelliteanglevalue").replaceWith(
									"<td id ='rollsatelliteanglevalue'>"
											+ rollsatelliteangle + "</td>");
							jQuery("#pitchsatelliteanglevalue").replaceWith(
									"<td id ='pitchsatelliteanglevalue'>"
											+ pitchsatelliteangle + "</td>");
							jQuery("#yawsatelliteanglevalue").replaceWith(
									"<td id ='yawsatelliteanglevalue'>"
											+ yawsatelliteangle + "</td>");
							jQuery("#solarazimuthvalue").replaceWith(
									"<td id ='solarazimuthvalue'>"
											+ solarazimuth + "</td>");
							jQuery("#solarzenithvalue").replaceWith(
									"<td id ='solarzenithvalue'>" + solarzenith
											+ "</td>");
							jQuery("#satelliteazimuthvalue").replaceWith(
									"<td id ='satelliteazimuthvalue'>"
											+ satelliteazimuth + "</td>");
							jQuery("#satellitezenithvalue").replaceWith(
									"<td id ='satellitezenithvalue'>"
											+ satellitezenith + "</td>");
							jQuery("#gainmodevalue").replaceWith(
									"<td id ='gainmodevalue'>" + gainmode
											+ "</td>");
							jQuery("#integrationtimevalue").replaceWith(
									"<td id ='integrationtimevalue'>"
											+ integrationtime + "</td>");
							jQuery("#integrationlevelvalue").replaceWith(
									"<td id ='integrationlevelvalue'>"
											+ integrationlevel + "</td>");
							jQuery("#earthellipsoidvalue").replaceWith(
									"<td id ='earthellipsoidvalue'>"
											+ earthellipsoid + "</td>");
							jQuery("#zonenovalue")
									.replaceWith(
											"<td id ='zonenovalue'>" + zoneno
													+ "</td>");
							jQuery("#resamplingkernelvalue").replaceWith(
									"<td id ='resamplingkernelvalue'>"
											+ resamplingkernel + "</td>");
							jQuery("#heightmodevalue").replaceWith(
									"<td id ='heightmodevalue'>" + heightmode
											+ "</td>");
							jQuery("#ephemerisdatavalue").replaceWith(
									"<td id ='ephemerisdatavalue'>"
											+ ephemerisdata + "</td>");
							jQuery("#attitudedatavalue").replaceWith(
									"<td id ='attitudedatavalue'>"
											+ attitudedata + "</td>");
							jQuery("#radiometricmethodvalue").replaceWith(
									"<td id ='radiometricmethodvalue'>"
											+ radiometricmethod + "</td>");
							jQuery("#mtfcorrectionvalue").replaceWith(
									"<td id ='mtfcorrectionvalue'>"
											+ mtfcorrection + "</td>");
							jQuery("#denoisevalue").replaceWith(
									"<td id ='denoisevalue'>" + denoise
											+ "</td>");
							jQuery("#rayleighcorrectionvalue").replaceWith(
									"<td id ='rayleighcorrectionvalue'>"
											+ rayleighcorrection + "</td>");
							jQuery("#usedgcpnovalue").replaceWith(
									"<td id ='usedgcpnovalue'>" + usedgcpno
											+ "</td>");
							jQuery("#centerlatitudevalue").replaceWith(
									"<td id ='centerlatitudevalue'>"
											+ centerlatitude + "</td>");
							jQuery("#centerlongitudevalue").replaceWith(
									"<td id ='centerlongitudevalue'>"
											+ centerlongitude + "</td>");
							jQuery("#topleftlatitudevalue").replaceWith(
									"<td id ='topleftlatitudevalue'>"
											+ topleftlatitude + "</td>");
							jQuery("#topleftlongitudevalue").replaceWith(
									"<td id ='topleftlongitudevalue'>"
											+ topleftlongitude + "</td>");
							jQuery("#toprightlatitudevalue").replaceWith(
									"<td id ='toprightlatitudevalue'>"
											+ toprightlatitude + "</td>");
							jQuery("#toprightlongitudevalue").replaceWith(
									"<td id ='toprightlongitudevalue'>"
											+ toprightlongitude + "</td>");
							jQuery("#bottomrightlatitudevalue").replaceWith(
									"<td id ='bottomrightlatitudevalue'>"
											+ bottomrightlatitude + "</td>");
							jQuery("#bottomrightlongitudevalue").replaceWith(
									"<td id ='bottomrightlongitudevalue'>"
											+ bottomrightlongitude + "</td>");
							jQuery("#bottomleftlatitudevalue").replaceWith(
									"<td id ='bottomleftlatitudevalue'>"
											+ bottomleftlatitude + "</td>");
							jQuery("#bottomleftlongitudevalue").replaceWith(
									"<td id ='bottomleftlongitudevalue'>"
											+ bottomleftlongitude + "</td>");
							jQuery("#topleftmapxvalue").replaceWith(
									"<td id ='topleftmapxvalue'>" + topleftmapx
											+ "</td>");
							jQuery("#topleftmapyvalue").replaceWith(
									"<td id ='topleftmapyvalue'>" + topleftmapy
											+ "</td>");
							jQuery("#toprightmapxvalue").replaceWith(
									"<td id ='toprightmapxvalue'>"
											+ toprightmapx + "</td>");
							jQuery("#toprightmapyvalue").replaceWith(
									"<td id ='toprightmapyvalue'>"
											+ toprightmapy + "</td>");
							jQuery("#bottomrightmapxvalue").replaceWith(
									"<td id ='bottomrightmapxvalue'>"
											+ bottomrightmapx + "</td>");
							jQuery("#bottomrightmapyvalue").replaceWith(
									"<td id ='bottomrightmapyvalue'>"
											+ bottomrightmapy + "</td>");
							jQuery("#bottomleftmapxvalue").replaceWith(
									"<td id ='bottomleftmapxvalue'>"
											+ bottomleftmapx + "</td>");
							jQuery("#bottomleftmapyvalue").replaceWith(
									"<td id ='bottomleftmapyvalue'>"
											+ bottomleftmapy + "</td>");
							jQuery("#orbitidvalue").replaceWith(
									"<td id ='orbitidvalue'>" + orbitid
											+ "</td>");
							jQuery("#overalldataqualityvalue").replaceWith(
									"<td id ='overalldataqualityvalue'>"
											+ overalldataquality + "</td>");
							if (thumbfilelocation == "null") {
								jQuery("#thumbfilelocationvalue")
										.replaceWith(//bottomleftlongitude bottomleftlatitude toprightlongitude toprightlatitude
												"<input id = \"thumbfilelocationvalue\"  type = \"hidden\"/> ");
							} else {
								jQuery("#thumbfilelocationvalue")
										.replaceWith(//bottomleftlongitude bottomleftlatitude toprightlongitude toprightlatitude
												"<img id = \"thumbfilelocationvalue\" width=\"197\" height = \"197\" src=\""
														+ thumbfilelocation
														+ "\" title=\"page to map\" onclick=\"addImageToMap("
														+ bottomleftlongitude
														+ ","
														+ bottomleftlatitude
														+ ","
														+ bottomrightlongitude
														+ ","
														+ bottomrightlatitude
														+ ","
														+ toprightlongitude
														+ ","
														+ toprightlatitude
														+ ","
														+ topleftlongitude
														+ "," + topleftlatitude
														+ ",'"
														+ thumbfilelocation
														+ "');\" />");
							}

							//			alert(productlevel + "   " + productdate + "   " + scenepath
							//					+ "   " + scenerow + "   " + centerlatitude + "   "
							//					+ centerlongitude + "   " + band + "   "
							//					+ thumbfilelocation);
						} catch (e) {
							alert("Error in XML response:" + e);
						}

					}, 'xml');

}
